﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace TianShu.Office.Abstractions
{
    public interface IExcelWriteService
    {
        void InitWriteWorkbook(string templateFilePath);
        void WriteListByNameManager<T>(List<T> datas, string sheetName = "Sheet1");
        void SaveWriteWorkbook(string saveFilePath);
        /// <summary>
        /// 根据名称管理器读取excel内容为一个列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sheetName"></param>
        /// <returns></returns>
        void WriteListByNameManager<T>(string templateFilePath, string saveFilePath, List<T> datas, string sheetName = "Sheet1") where T : class, new();
        /// <summary>
        /// 根据名称管理器读取excel内容为一个列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sheetName"></param>
        /// <returns></returns>
        void WriteListByNameManager<T>(Stream templateFileStream, Stream saveFileStream, List<T> datas, string sheetName = "Sheet1") where T : class, new();

        /// <summary>
        /// 合并单元格
        /// </summary>
        /// <param name="startRowIndex"></param>
        /// <param name="endRowIndex"></param>
        /// <param name="startColumnIndex"></param>
        /// <param name="endColumnIndex"></param>
        /// <param name="sheetName"></param>
        void MergeCell(int startRowIndex, int endRowIndex, int startColumnIndex, int endColumnIndex, string sheetName = "Sheet1");
        (List<ExcelNameManger>, int) GetNameManagerList(string sheetName = "Sheet1");
    }
}
